Repository navigation
ENH: add adaptive_max_weight option - #604
Merged
Merged
Conversation
adaptive_max_weight option
redeboer
commented
Nov 9, 2026
Member
Author
There was a problem hiding this comment.
⚠️ Performance Alert ⚠️
Possible performance regression was detected for benchmark 'TensorWaves benchmark results'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.
| Benchmark suite | Current: 5b07657 | Previous: 96c79ad | Ratio |
|---|---|---|---|
benchmarks/expression.py::test_fit[1000-ScipyMinimizer-numpy] |
7.2276343184668725 iter/sec (stddev: 0.00028008404111654756) |
16.20089733282377 iter/sec (stddev: 0.0002919331648110754) |
2.24 |
benchmarks/expression.py::test_fit[1000-ScipyMinimizer-numba] |
7.21115272770527 iter/sec (stddev: 0.0004044606208413481) |
15.719486023422135 iter/sec (stddev: 0.00020436080552564467) |
2.18 |
benchmarks/expression.py::test_fit[1000-ScipyMinimizer-tf] |
0.6188479173610196 iter/sec (stddev: 0.00418789445532882) |
1.4510339953328852 iter/sec (stddev: 0.002136985793101471) |
2.34 |
benchmarks/unbinned_nll.py::test_unbinned_nll_normalization_formula[original-numpy] |
28.41610169418186 iter/sec (stddev: 0.0007061197959512932) |
83.16394792483862 iter/sec (stddev: 0.00007097826620654797) |
2.93 |
benchmarks/unbinned_nll.py::test_unbinned_nll_normalization_formula[original-tensorflow] |
60.108170797735816 iter/sec (stddev: 0.00041351329718404377) |
127.70369911146068 iter/sec (stddev: 0.00019483109407062498) |
2.12 |
benchmarks/unbinned_nll.py::test_unbinned_nll_normalization_formula[optimized-numpy] |
37.03909610031483 iter/sec (stddev: 0.0005525523557448707) |
128.90182339052615 iter/sec (stddev: 0.00007047725297610706) |
3.48 |
benchmarks/unbinned_nll.py::test_unbinned_nll_normalization_formula[optimized-tensorflow] |
61.67090841262568 iter/sec (stddev: 0.001321918594487155) |
157.36058719247046 iter/sec (stddev: 0.0002361793019890102) |
2.55 |
benchmarks/unbinned_nll.py::test_unbinned_nll_estimator[numpy] |
126.83837785976952 iter/sec (stddev: 0.00016396145310168205) |
342.6441228883796 iter/sec (stddev: 0.0001794193509548101) |
2.70 |
benchmarks/unbinned_nll.py::test_unbinned_nll_estimator[numba] |
96.73901726107701 iter/sec (stddev: 0.0010175312768236438) |
535.093309487275 iter/sec (stddev: 0.00012515060065815384) |
5.53 |
This comment was automatically generated by workflow using github-action-benchmark.
redeboer
force-pushed
the
faster-hit-and-miss
branch
from
November 9, 2026 09:45
5b07657 to
800ae3f
Compare
redeboer
marked this pull request as ready for review
November 12, 2026 16:42
redeboer
force-pushed
the
faster-hit-and-miss
branch
from
November 17, 2026 20:38
4088a52 to
2145f01
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
⚙️ Enhancements
TFPhaseSpaceGeneratorgets a keyword-onlyadaptive_max_weightargument. Withadaptive_max_weight=True, the hit-and-miss step draws its random numbers up to an estimate of the maximum weight instead of up to the upper bound thatphasespaceguarantees. The estimate is the largest weight of the bunches so far with a margin of 5%. When a bunch exceeds it, the estimate is raised and generation restarts, like inIntensityDistributionGenerator. The estimate never exceeds the bound, so the option is never less efficient than the default.The default stays
False, so existing code gets exactly the same samples for the same seed. With the option, the distribution is the same, but the events differ.The gain grows with the number of final state particles. For 10,000 events of a 5 GeV particle that decays into pions, a local run took:
adaptive_max_weight=TrueFor few particles, both settings need a single bunch of 50,000 events, so the times are equal.
📝 Documentation
adaptive_max_weight=True. Benchmarks and statistical comparisons of both settings live in TR-038, so that the page only illustrates the feature and runs in about 10 s. Until TR-038 is published,nitpick_ignoresuppresses the unresolved link to it.Squash commit messages